/*
* 用于session数据存储
*/
export function saveToSession (key, value) {
  let ret = JSON.stringify(value)
  let sessionStorage = window.sessionStorage
  sessionStorage.setItem(key, ret)
};

export function loadFromSession (key, def) {
  let sessionStorage = window.sessionStorage
  let res = sessionStorage.getItem(key)
  if (res !== '0') {
    res = JSON.parse(res)
  }
  return res || def
};

export function removeSession (key) {
  let sessionStorage = window.sessionStorage
  sessionStorage.removeItem(key)
}
